package com.example.yls.mydemo;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by yls on 2019/4/19.
 */

public class MyFramgentPageAdapter extends FragmentPagerAdapter {

   public ArrayList<Fragment> fragmentArrayList;

    public MyFramgentPageAdapter(FragmentManager fm, ArrayList<Fragment> fragmentArrayList) {
        super(fm);
        this.fragmentArrayList = fragmentArrayList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentArrayList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentArrayList.size();
    }

    public CharSequence getPageTitle(int position){
      switch (position){
          case 0:
              return "消息";
          case 1:
              return "通讯录";
          case 2:
              return "发现";
          case 3:
              return "我的";

      }




        return null;
    }
}
